class CardDetail extends eui.Component{
	// private _card:BaseCard
	private _cardImg:CardComponent
	private layCard:eui.Group
	private txtSetOp:eui.Component
	private _stageH:number
	public constructor() {
		super()
		this.skinName = 'resource/eui_skins/scene/carddetail.exml'
		this._stageH = egret.MainContext.instance.stage.stageHeight
	}

	/**显示位置：0=不显示， 1=舞台上半， -1=舞台下半 */
	public get showPlace():-1|0|1{
		if(!this.visible){
			return 0
		}
		if(this.y > this._stageH/2){
			return -1
		}else{
			return 1
		}
	}

	public set card(c:BaseCard){
		const t = this
		t.txtSetOp.visible = false
		switch(c.type){
			case CardType.WEAPON:
				t.currentState = 'weapon'
				break
			case CardType.ACT_SHIELD:
				t.currentState = 'actshield'
				break
			case CardType.SET_SHIELD:
				t.currentState = 'setshield'
				if((c as SetShieldCard).opSetable){
					t.txtSetOp.visible = true
				}
				break
			case CardType.SKILL:
				t.currentState = 'skill'
				break
		}
		if(!t._cardImg){
			const cpn = new CardComponent(c)
			
			const scaleX =  t.layCard.width / cpn.width
			const scaleY =  t.layCard.height / cpn.height
			cpn.scaleX = scaleX
			cpn.scaleY = scaleY
			// cpn.x = t.layCard.width/2
			// cpn.y = t.layCard.height/2
			
			t.layCard.addChild(cpn)
			t._cardImg = cpn
		}else{
			t._cardImg.card = c
		}
	}
}